package com.itsu.admin.controller;

import com.itsu.admin.service.DataBackUpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @author Jerry.Su
 * @Date 2022/2/10 15:27
 */
@RestController
@RequestMapping("/backup")
public class DataBackUpController {

    @Resource
    private DataBackUpService dataBackUpService;

    @GetMapping("/export/{containDownNode}")
    public void export(@PathVariable("containDownNode") int containDownNode, HttpServletResponse response) throws IOException {
        dataBackUpService.dataBackUpExport(response, containDownNode == 0);
    }
}
